<?php
if (isset($_COOKIE["ImOnline"])){
	//print($_COOKIE["ImOnline"]);
	//print("Welcome back " . $_COOKIE["Username"]);
} else {
	header( 'Location: index.php?error=You have no access to this page' );
	die("<center><br><br><br><img src=\"img/logo.jpg\" \><br>Your webbrowser dont support redirecting.<br>You have no access to this page. <br><a href=\"index.php\">Please go to main page</a></center>");
	//print($_COOKIE["imonline"]);
	};
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Users - Garrysmod Web</title>
	<script type="text/javascript" src="js/selectuser.js"></script>
	<script type="text/javascript" src="js/lib/prototype.js"></script>
	<script type="text/javascript" src="js/lib/scriptaculous.js?load=effects"></script>
	<script type="text/javascript" src="js/modalbox.js"></script>
    
    <link rel="stylesheet" type="text/css" href="css/default.css" />
    <link rel="stylesheet" href="css/modalbox.css" type="text/css" />
    	<style type="text/css" media="screen">
		#MB_loading {
			font-size: 13px;
		}
		#errmsg {
			margin: 1em;
			padding: 1em;
			color: #C30;
			background-color: #FCC;
			border: 1px solid #F00;
		}
	</style>
    <script type='text/javascript'>
	function OpenAjax(sid,Nick,Username,type,Usertype){
		if (type == "status"){
			Html = "<form action='includes/userfunctions.php' method='post'><table width='300' border='0'><tr><td width='75'>In-Game:</td><td width='215'>"+Nick+"</td></tr><tr><td>Username:</td><td>"+Username+"</td></tr><tr><td>SteamID:</td><td>"+sid+"<input id='steamid' name='sid' type='hidden' value='"+sid+"'/><input type='hidden' name='usertype' value='"+Usertype+"'></td></tr><tr><td>Status:</td><td><label><select name='status' id='status'><option value='0'>Guest</option><option value='1'>VIP</option><option value='2'>Admin</option></select></label></td></tr><tr><td>&nbsp;</td><td><label><input type='submit' value='Submit'></label></td></tr></table></form>"
			Modalbox.show(Html, {title: "Set User Status" });
		}else{
			Html = "<form action='includes/ban.php' method='post'><p>Username: "+Nick+"<br><label>Ban time:</label><label>Days:<select width='10px' name='days'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option><option value='29'>29</option><option value='30'>30</option><option value='31'>31</option></select></label><label>Hours:<select name='hours'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option></select></label><br><input type='hidden' name='sid' value='"+sid+"'><input type='hidden' name='uname' value='"+Nick+"'><input type='hidden' name='usertype' value='"+Usertype+"'><input type='submit' value='Submit'></p></form>"
			Modalbox.show(Html, {title: "Ban User" });
			};
		}
	</script>
</head>
<body>
<div id="page-wrap">
<?php
include("includes/header.html");
?>
<h2>Users</h2><p>
  <?php
	if(isset($_GET['error'])){
	$error = urldecode($_GET['error']);
	print("<p id=\"error\">$error</p>");
	}else{
	print("<p></p>");
	};
  ?>
<form>
Select a User-Type:
<select name="users" onclick="showUser(this.value)">
<option value="-1">All</option>
<option value="0">Guests</option>
<option value="1">VIP</option>
<option value="2">Admin</option>
<option value="3">Owner</option>
</select>
</form></p>
<div id="txtHint"><b>Select a user-type and all users within it will show up.</b></div>
</div>
<?php
include("includes/footer.html");
?>
</body>
</html>